<style type="text/css">
.manage_topic{
	cursor:pointer;
	display:{$userdb.uid!=$info.uid&&fun('admin@sort',$info['fid'])!==true?'none !important':''};
}
.manage_button{
	font-size:16px;
	background:#fff;
	color:rgb(15, 166, 216);
	padding:3px 8px 5px 8px;
	border-radius:3px;
	margin:5px 0 15px 0;
	display:block;
}
.menu_highlight{
	color:red;
}
</style>
<script type="text/javascript">
$(function(){
	$(".manage_topic").click(function(){
		layer.tips($("#manage_topic_warp").html(), $(this), {tips: [3, '#0FA6D8'],tipsMore: false,time:4000 });
	});
});
 
</script>
<div style="display:none;" id="manage_topic_warp">
	<a href="{:murl('content/edit')}?id={$id}" class="manage_button" target="blank">修改主题</a>
	<a href="javascript:" onclick="layer.confirm('你确认要删除吗?',function(){ window.location.href='{:murl('content/delete')}?ids={$id}' })" class="manage_button _alert">删除主题</a>		
	<a href="{:murl('content/add')}?fid={$info.fid}" class="manage_button" target="blank">发表主题</a>
{if M('key')=='cms'&&$info.mid==1}
	<a href="{:murl('pages/add')}?aid={$id}" class="manage_button" target="blank">续发多页</a>
	<a href="{:murl('pages/index')}?aid={$id}" class="manage_button" target="blank">管理多页</a>
{/if}

{if fun('admin@sort',$info['fid'])===true}
	{if $info.list>time()}
		<a onclick="api_get('{:urls('wxapp.api/recover','id='.$id)}','你要取消置顶吗?',this)" class="manage_button menu_highlight" title="取消置顶">取消置顶</a>
	{else /}
		<a onclick="set_topic_top('{:urls('wxapp.api/top','id='.$id)}',this)" class="manage_button" title="排序置顶">栏目置顶</a>
	{/if}
{/if}
</div>

<script type="text/javascript">
function post_act_menu(url,obj){
	layer.load(1);
	$.get(url,function(res){
		layer.closeAll();
			if(res.code==0){
				layer.msg('操作成功');
				if($(obj).hasClass('menu_highlight')){
					$(obj).removeClass('menu_highlight');
				}else{
					$(obj).addClass('menu_highlight');
				}
			}else if(res.code==1){
				layer.alert(res.msg);
			}else{
				layer.alert('未知错误');
			}
	}).fail(function(){
			layer.alert('页面出错');
	});
}
function api_get(url,msg,obj,type){
	if(type=='color'){
		layer.confirm(msg,{title:false,btn:['加红色','加蓝色','取消'],btn2:function(){
			post_act_menu(url+"?type=blue",obj);
		}},function(index){
			post_act_menu(url,obj);
		});
	}else{
		layer.confirm(msg,{title:false,},function(index){
			post_act_menu(url,obj);
		});
	}
}

function set_topic_top(url,obj){
	layer.prompt({
		  formType: 0,
		  value: '3',
		  title: '请输入要置顶多少天?',
		  //area: ['100px', '20px'] //formType:2 自定义文本域宽高
		}, function(value, index, elem){
			layer.close(index);
			var time = value * 24;	//单位小时
			post_act_menu(url+'?time='+time,obj);
	});
}
</script>